var express = require('express');
var router = express.Router();
var checkSession = require('../jsbean/CheckSession')
var questionModel = require('../modules/questionModel')

router.all('/ask',function(req,res){
	loginbean = checkSession.check(req,res)
	console.log('已进入提问页面')
	if(!loginbean){
		retrun;
	}
	var subflag = req.body['subflag']
	if(subflag == undefined){
		console.log('已进入提问页面，未点击提问按钮')
		res.render('ask',{loginbean:loginbean});
	}else{
		console.log('已进入提问页面，并且点击提问按钮')
		console.log('准备写入数据库')
		questionModel.ask(req,res);
	}
	// res.render('ask');
})
router.get('/detail',function(req,res){
	questionModel.queDetail(req,res)
})

module.exports = router;

















